/* 
    post参数
*/
const querystring = require("querystring");
const http = require('http');

// let param = 'username=lisi&password=1234567';
// let obj = querystring.parse(param);
// console.log( obj );


// let obj1 = {
//     flag: '124',
//     abc: ['hello','hi']
// };

// let string = querystring.stringify(obj1);
// console.log(string);

http.createServer((req,res)=>{
     if (req.url.startsWith('/login')){
        let pdata = '';
        req.on('data',(chunk)=>{
            pdata += chunk;
        });

        req.on('end',()=>{
            console.log(pdata);
            let obj = querystring.parse(pdata);
            res.end(obj.username+'=========='+obj.password);
        }) 
    } 
}).listen(3000,()=>{
    console.log('running……');
});











